<template>
	<view>
		<view class="content" @click="goImgs()">
			<text>头像</text>
			<uni-icons type="arrowright" color="#C6C5C3" style="float: right;margin-right: 28rpx;"></uni-icons>
			<image src="../../../static/addition/add-imgs1.png" mode=""></image>
		</view>
		<uni-list class="list_information">
			<uni-list-item title="姓名" link="navigateTo" rightText="山东榴弹制烟花研发制造集团" @click="goName">	
			</uni-list-item>
			<!-- <input v-if="isText" type="text" placeholder="山东榴弹制烟花研发制造集团" /> -->
		<uni-popup ref="name" type="dialog">
		    <uni-popup-dialog mode="input" message="成功消息" :duration="2000" :before-close="true" @close="close" @confirm="confirm"></uni-popup-dialog>
		</uni-popup>
			<uni-list-item title="性别" link="navigateTo" rightText="男"  @click="opento" >
			</uni-list-item>
			<!-- 性别 -->
			<uni-popup ref="xingbie" type="bottom" class="poup1">
				<view style="display: flex; padding-left:30%; background-color: #FFFFFF; height: 181rpx; line-height: 181rpx;">
					<label class="radio">
						<radio value="0" :checked="xuanzhong==='0'" @click="radio('0')"/>
					</label>
					<view class="xing">男</view>
				</view>
				<view style="display: flex; padding-left:30%; padding-bottom: 81rpx; background-color: #FFFFFF;">
					<label class="radio">
						<radio value="1" :checked="xuanzhong==='1'" @click="radio('1')"/>
					</label>
					<view class="xing">女</view>
				</view>
				<view style="display: flex; padding-left:30%; padding-bottom: 81rpx; background-color: #FFFFFF;">
					<label class="radio">
						<radio value="2" :checked="xuanzhong==='2'" @click="radio('2')"/>
					</label>
					<view class="xing">未知</view>
				</view>
			</uni-popup>
			
			
			<!-- 性别 -->
			<uni-list-item title="手机号" link="navigateTo" rightText="15562899253"></uni-list-item>
		</uni-list>
		<uni-list class="list_information">
			<uni-list-item title="身份" link="navigateTo" rightText="一般企业"></uni-list-item>
			<uni-list-item title="自我介绍" link="navigateTo" rightText="这里是自我介绍（个性签名），自动换行"></uni-list-item>
		</uni-list>
		
		<!-- -------------------------- -->
		<!-- <popup-layer ref="popupRef" :direction="'top'">
		  <view class="zidingyiBox">
			  1111111
		  </view>
		</popup-layer>
		 <button type="primary" @tap="show">弹出</button> -->
		
	</view>
</template>

<script>
	// 以下路径需根据项目实际情况填写
	import {
		pathToBase64,
		base64ToPath
	} from '@/js_sdk/mmmm-image-tools/index.js'
	
	import popupLayer  from '@/components/uni-popup/uni-popup.vue'
	export default {
		 components:{
		            popupLayer
		        },
	
			data() {
				return {
					"title": "",
					verifyToken: '45346456',
					code: ''  ,//登录状态
					msg: '', // 错误信息
					data: [], // 数据
					toimgs: '',// 图片转换
					xuanzhong:'0',
					isText: false,
					name: ''
				}
			},
			onLoad() {
				this.goAttent()
			},
		    methods: {
			goName() {
				this.isText = true
				 this.$refs.name.open('top')
				 console.log(this.$refs.name)
			
			},
			close() {
								 this.$refs.name.close()
			},
			confirm(value) {
								 console.log(value)
								 this.$refs.name.close()
								 var that = this
								 that.name = value
								 console.log(that.name)
								 that.$http.req.ajax({
								      path: ':8066/web/lxUser/getUserRna',
								      header: {
								      'token': uni.getStorageSync('token')
								      },
								 	 data: {
								 		nickName: that.toimgs
								 	 },
								      afterAjax: (res) => {
								 		 		console.log(res,'昵称修改成功')
								 				that.data = res.data
								 				console.log(that.data)
								      }
								     })
			},
			opento(){
				        // 通过组件定义的ref调用uni-popup方法 ,如果传入参数 ，type 属性将失效 ，仅支持 ['top','left','bottom','right','center']
				        // this.popup.opento('top')
						console.log(11)
						            this.$refs.xingbie.open()

				      },
				radio(e){
						console.log(e,'---')
						var that = this
						that.xuanzhong=e  //把传过来的值赋给点击的按钮
						
						that.$http.req.ajax({
						     path: ':8066/web/lxUser/getUserRna',
						     header: {
						     'token': uni.getStorageSync('token')
						     },
							 data: {
								sex: that.toimgs
							 },
						     afterAjax: (res) => {
								 		console.log(res,'性别提取成功')
										that.data = res.data
										console.log(that.data)
						     }
						    })
						
				  },
				goImgs() {
					var that = this
				uni.chooseImage({ // 从本地相册选择图片或使用相机拍照。
							count: 1,//默认选择1张图片
							sizeType: ['original', 'compressed'],//original 原图，compressed 压缩图，默认二者都有
							success:  (res)=> {
								console.log(res.tempFilePaths[0]);//成功则返回图片的本地文件路径列表 tempFilePaths
								pathToBase64(res.tempFilePaths[0]).then(base64 => {
										console.log(base64)
										that.toimgs=base64
									})
									.catch(error => {
										console.error(error)
									}
									)
								console.log('----------------')
								
								that.$http.req.ajax({
								     path: ':8066/web/lxUser/getUserRna',
								     header: {
								     'token': uni.getStorageSync('token')
								     },
									 data: {
										 headImg: that.toimgs
									 },
								     afterAjax: (res) => {
										 		console.log(res,'后台拿取用户验证状态--------')
												// that.data = res.data
												// console.log(that.data)
								     }
								    })
							}
						});
				},
			goAttent() {
				var that = this
				that.$http.req.ajax({
				     path: ':8066/web/lxUser/getUserRna',
				     header: {
				     'token': uni.getStorageSync('token')
				     },
				     afterAjax: (res) => {
						 		console.log(res,'后台拿取用户验证状态')
								that.data = res.data
								console.log(that.data)
				     }
				    })
			},
		  
			
		    },
		
	}
</script>

<style>
	page{
		background: #F5F5F5;
	}
	.content{
		width: 750rpx;
		height: 188rpx;
		margin-top: 25rpx;
		background: #FFFFFF;
	}
	.content text{
		margin-left: 21rpx;
		line-height: 188rpx;
	}
	.content image{
		width: 123rpx;
		height: 123rpx;
		float: right;
		margin-top: 32rpx;
	}
	.list_information{
		margin-top: 25rpx;
	}
	.poup1 {
		background-color: #F5f5f5;
		width: 750rpx;
		height: 543rpx;
		display: flex;
		flex-direction: row;
		justify-content: space-around;
		margin-bottom: 181rpx;
		.xing {
			width: 750rpx;
			height: 144rpx;
			border: 1px solid#007AFF;
			margin-left: 100rpx;
		}
		radio {
			
		}

	}
</style>
